package com.forekenow.Demo4.exercise0726;

public class Animal {
    public String name;
    public int legNum;

    public Animal(String name, int legNum) {
        this.name = name;
        this.legNum = legNum;
    }

    public String getName() {
        return name;
    }

    public int getLegNum() {
        return legNum;
    }

    public void shout(){
        if (legNum == 4){
            System.out.println(name+"---------"+legNum+"---------"+"喵喵喵");
        }
        if (legNum==2){
            System.out.println(name+"---------"+legNum+"---------"+"嘎嘎嘎");
        }
    }


    }

